import Cookies from 'js-cookie'

const TokenKey = 'accessToken'

export function getToken() {
  let token = Cookies.get(TokenKey)
  if (!token) {
    token = sessionStorage.getItem(TokenKey)
  }

  return token
}

export function setToken(token) {
   Cookies.set(TokenKey, token)
    sessionStorage.setItem(TokenKey, token)
}

export function removeToken() {
   Cookies.remove(TokenKey)
   sessionStorage.clear()
}
